
#include "LWP.h"
#include "HTTP.h"

#include <iostream>
#include <string>

using namespace HTTP;

int main()
{
	LWP::UserAgent::UserAgent ua;
	ua.agent("MyAPP/0.1");

	HTTP::Request req("http://search.cpan.org/search", HTTP::HttpRequestType::POST);
	req.add_header("Content-Type", "application/x-www-form-urlencoded");
	req.content("query=libwww-perl&mode=dist");
	
	HTTP::Response res = ua.request(req);

	if(res.is_success())
		std::cout<<res.content();
	else
	{
// Use get_error instead of status_line temporarily
// We will improve it
		std::cout<<res.get_error()<<endl;
//		std::cout<<res.status_line();
	}

}


